|
|
|
|
|
|
|
Now update the BindControls procedure to set the DataField property of the label control. Your code should look like this: |
|
|
|
|
|
|
|
|
Public Sub BindControls ()
Dim cField1 As String
Dim cField2 As String
'
cField1 = "Name"
cField2 = "AuID"
'
Text1.DataField = cField1
Label1.DataField = cField2
End Sub |
|
|
|
|
|
|
|
|
Now save and run the project. You'll see that the label control contains the values stored in the AuID field of the Dynaset. As you move through the Dynaset using the arrow buttons, the label control is updated just as the text control is updated. |
|
|
|
|
|
|
|
|
The Bound Checkbox Control |
|
|
|
|
|
|
|
|
The bound checkbox control is basically the same as the text control. It has no special database-related events or methods and has the same two database-related properties: DataSource and DataField. The difference between the text box control and the checkbox control is in how the data is displayed on the form and saved in the Dynaset. |
|
|
|
|
|
|
|
|
Checkboxes are linked to Boolean data type fields. You'll remember that these fields can only hold -1 or 0. Checkboxes do not display -1 or 0. They display an empty box (0) or a checked box (-1). By clicking the display of the checkbox, you can actually update the Boolean value of the bound Dynaset field. |
|
|
|
|
|
|
|
|
Using Figure 4.8 as a guide, add a checkbox control to the form. Set its DataSource property to Data1 and its Caption property to Under Contract. You do not need to set the DataField property at this time. This will be done by modifying the BindControls procedure. |
|
|
|
|
|
|
|
|
Figure 4.8.
Adding the bound checkbox control. |
|
|
|
|
|